﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace JuCloudy.App.Toursim.Root
{
    public partial class PerDayPlan : UserControl
    {
        public PerDayPlan(int DayNo)
        {
            InitializeComponent();

            this.chk_breakfast.IsChecked = false;
            this.chk_dinner.IsChecked = false;
            this.chk_lunch.IsChecked = false;

            this.Loaded += (obj, e) =>
            {
                this.Day = DayNo;
            };
        }

        public new String Content
        {
            get { return this.txt_content.Text; }
            set { this.txt_content.Text = value; }
        }

        public int Day
        {
            get { return int.Parse(this.txt_Day.Text); }
            set { this.txt_Day.Text = value.ToString(); }
        }

        public bool HasBreakfast
        {
            get { return (bool)this.chk_breakfast.IsChecked; }
            set { this.chk_breakfast.IsChecked = value; }
        }

        public bool HasLunch
        {
            get { return (bool)this.chk_lunch.IsChecked; }
            set { this.chk_lunch.IsChecked = value; }
        }

        public bool HasDinner
        {
            get { return (bool)this.chk_dinner.IsChecked; }
            set { this.chk_dinner.IsChecked = value; }
        }

        public String Hotel
        {
            get { return this.txt_hotel.Text; }
            set { this.txt_hotel.Text = value; }
        }

        private void com_hotel_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems != null && e.AddedItems.Count > 0)
                this.txt_hotel.Text = ((ComboBoxItem)e.AddedItems[0]).Content.ToString();
        }

        public JuCloudy.Data.Entity.AppEntity.PlanEntity GetEntity()
        {
            return new Data.Entity.AppEntity.PlanEntity()
            {
                Content = this.Content,
                Day = this.Day,
                HasBreakfast = this.HasBreakfast,
                HasDinner = this.HasDinner,
                HasLunch = this.HasLunch,
                Hotel = this.Hotel
            };
        }
    }
}
